create database Students
on
(
 name='Students',
 filename='D:\text\Students.mdf',
 size=5MB,
 maxsize=100MB,
 filegrowth=10MB
)
log on
(
name='Students_log',
 filename='D:\text\Students_log.mdf',
 size=5MB,
 maxsize=100MB,
 filegrowth=10MB
)
go

use  Students
go

create table Stulnfo
(
StuID int primary key identity(1,1) not null,
StuNum char(10) not null,
StuName nvarchar(20),
StuSex char(2) default('') check(StuSex='' or StuSex='Ů'),
StuPhone int
)
go

create table Classlnfo
(
ClssID int primary key identity(1,1) not null,
ClassNum char(15) not null,
ClassName nvarchar(15) not null,
CalssRemark text,
StuID int
)
go

alter table Classlnfo
add constraint FK_Class_Stulnfo foreign key(StuID)
references Stulnfo(StuID)
go